//package com.cebbank.sz.cebtemplate.aspect;
//
//import com.cebbank.sz.cebtemplate.annotation.DataSource;
//import com.cebbank.sz.cebtemplate.config.datasource.DataSourceContextHolder;
//import org.aspectj.lang.annotation.After;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.annotation.Pointcut;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//
///**
// * @author sucz
// * @create 2019/12/16 12:34
// */
//@Component
//@Aspect
//@Order(-1)
//public class DataSourceAspect {
//
//    private final Logger logger=LoggerFactory.getLogger(DataSourceAspect.class);
//
//    @Pointcut("@within(com.cebbank.sz.cebtemplate.annotation.DataSource) || @annotation(com.cebbank.sz.cebtemplate.annotation.DataSource)")
//    public void pointCut() {
//
//    }
//
//    @Before("pointCut() && @annotation(dataSource)")
//    public void doBefore(DataSource dataSource) {
//        logger.info("切换数据源为：" + dataSource.value().getValue());
//        DataSourceContextHolder.setDataSource(dataSource.value().getValue());
//    }
//
//    @After("pointCut()")
//    public void doAfter() {
//        DataSourceContextHolder.clear();
//    }
//
//}
